package client;

import javax.swing.JFrame;
import javax.swing.JLabel;

import bean.Phone;
import bean.PhoneBrand;
import simpleFactoryMethod.SimpleFactory;

import java.awt.GridLayout;

public class SimpleFactoryMethodClient extends JFrame {
	public SimpleFactoryMethodClient() {
		getContentPane().setLayout(new GridLayout(7, 0, 0, 0));
		
		SimpleFactory factory = new SimpleFactory();
		Phone iPhone = factory.getPhone(PhoneBrand.IPhone);
		Phone mPhone = factory.getPhone(PhoneBrand.MiPhone);
		Phone sPhone = factory.getPhone(PhoneBrand.SamsungPhone);
		
		System.out.println(iPhone.getMessage());
		System.out.println(mPhone.getMessage());
		System.out.println(sPhone.getMessage());
		
		JLabel lbl1 = new JLabel("SimpleFactory factory = new SimpleFactory();");
		getContentPane().add(lbl1);
		
		JLabel lbl2 = new JLabel("Phone iPhone = factory.getPhone(PhoneBrand.IPhone);");
		getContentPane().add(lbl2);
		
		JLabel lbl3 = new JLabel("Phone mPhone = factory.getPhone(PhoneBrand.MiPhone);");
		getContentPane().add(lbl3);
		
		JLabel lbl4 = new JLabel("Phone sPhone = factory.getPhone(PhoneBrand.SamsungPhone);");
		getContentPane().add(lbl4);
		
		JLabel lbl5 = new JLabel(iPhone.getMessage());
		getContentPane().add(lbl5);
		
		JLabel lbl6 = new JLabel(mPhone.getMessage());
		getContentPane().add(lbl6);
		
		JLabel lbl7 = new JLabel(sPhone.getMessage());
		getContentPane().add(lbl7);
	}
	/**
	 * 
	 */
	private static final long serialVersionUID = -3145394445843649993L;

	public static void main(String[] args) {
		SimpleFactoryMethodClient view = new SimpleFactoryMethodClient();
		view.setBounds(200, 200, 400, 400);
		view.setVisible(true);
	}
}
